package com.wcpdoc.exam.core.dao.impl;

import com.wcpdoc.core.dao.impl.RBaseDaoImpl;
import com.wcpdoc.core.entity.PageIn;
import com.wcpdoc.core.entity.PageOut;
import com.wcpdoc.core.util.SqlUtil;
import com.wcpdoc.core.util.ValidateUtil;
import com.wcpdoc.exam.core.dao.MyAbnormalDao;
import com.wcpdoc.exam.core.entity.MyAbnormal;
import org.springframework.stereotype.Repository;

/**
 * 异常反馈数据访问层实现
 * 
 */
@Repository
public class MyAbnormalDaoImpl extends RBaseDaoImpl<MyAbnormal> implements MyAbnormalDao {

	@Override
	public PageOut getListpage(PageIn pageIn) {
		String sql = "SELECT * "
				+ "FROM EXM_MY_ABNORMAL ";
		SqlUtil sqlUtil = new SqlUtil(sql);
		sqlUtil.addWhere(ValidateUtil.isValid(pageIn.get("type")), "ABNORMAL_TYPE_ID=:TYPE", pageIn.get("type", Integer.class))
				.addWhere(pageIn.get("curUserId", Integer.class) != null, "USER_ID = :USER_ID", pageIn.get("curUserId", Integer.class))
				.addOrder("UPDATE_TIME", SqlUtil.Order.DESC);
		PageOut pageOut = getListpage(sqlUtil, pageIn);
		return pageOut;
	}

}